package com.mima.minaserver.repository;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.mima.minaserver.entity.MyUUID;



@Repository
public interface UUIDRepository extends JpaRepository<MyUUID, String> {
	/*@Modifying
	@Transactional
	@Query(value = "insert uuid (id,uuid,generate_time,is_active) values (?,?,getdate(),0)", nativeQuery = true)
	public void createUUID(Integer size);*/
	
	
	@Query(value = "select td.uuid,td.key_id from t_uuid td,t_camera tc where td.uuid = tc.uuid and tc.is_del = 0", nativeQuery = true)
	public List<Object> selectUUID();
	
	@Modifying
	@Transactional
	@Query(value = "update t_uuid set account=?1,password=?2 where uuid=?3", nativeQuery = true)
	public void updateSafeInfo(String account,String password,String uuid);
	
	@Modifying
	@Transactional
	@Query(value = "update t_uuid set secret_key=?1,key_id=?2 where uuid=?3", nativeQuery = true)
	public void updateSecretKey(String secretkey,int keyId,String uuid);
	
}
